package com.shao.im.application;

import com.shao.im.webSocket.WsServer;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * 应用启动类
 */
@Component
public class ApplicationRunning implements CommandLineRunner, DisposableBean {

    @Autowired
    private WsServer wsServer;

    @Override
    public void run(String... args) throws Exception {
        wsServer.start();
    }

    @Override
    public void destroy() throws Exception {
        wsServer.destroy();
    }
}
